<template>
  <div class="myself">
    <div class="myself-box">
      <el-form
        :model="userInfo"
        status-icon
        label-width="100px"
        class="demo-ruleForm"
      >
        <el-form-item label="名字">
          <el-input v-model="userInfo.name"></el-input>
        </el-form-item>
        <el-form-item label="密码">
          <el-input
            type="password"
            show-password
            v-model="userInfo.password"
            autocomplete="off"
          ></el-input>
        </el-form-item>

        <el-form-item label="性别">
          <el-radio-group v-model="userInfo.sex">
            <el-radio label="男"></el-radio>
            <el-radio label="女"></el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="年龄" prop="age">
          <el-input v-model.number="userInfo.age"></el-input>
        </el-form-item>
        <!-- <el-form-item label="身份" prop="poid">
          <el-select v-model="userInfo.poid" placeholder="所有身份">
            <el-option
              v-for="item in post"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item> -->
        <el-form-item label="出生日期" required>
          <el-col :span="9">
            <el-form-item>
              <el-date-picker
                format="yyyy 年 MM 月 dd 日"
                value-format="yyyy-MM-dd"
                placeholder="选择日期"
                v-model="userInfo.birthday"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-form-item>
        <el-form-item label="权限">
          <el-select v-model="userInfo.limits" placeholder="请选择你的权限">
            <el-option label="普通员工" value="false"></el-option>
            <el-option label="管理人员" value="true"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      userInfo: {
        // name: "",
        // pass: "",
        // checkPass: "",
        // sex: "",
        // age: "",
        // poid: "",
        // birthday: "",
        // limits: "",
        // other: "",
      },
    };
  },

  created() {
    this.getUserInfo();
  },
  methods: {
    getUserInfo() {
      // console.log("userInfo:" + this.$route.query.id);
      var id = window.localStorage.getItem("id");
      console.log("id" + id);

      this.axios
        .get("/getuserinfo", {
          params: {
            id: id,
          },
        })
        .then((response) => {
          console.log(response);
          this.userInfo = response.data[0];
        })
        .catch((error) => {
          console.log(error);
        });
    },
  },
};
</script>

<style>
</style>